package com.wendu.oa.leave.dao.leave;

import com.wendu.oa.leave.dto.LeaveDto;
import com.wendu.oa.leave.model.Leave;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ExamDao {

    List<Leave> findAppList(LeaveDto leaveDto);

    boolean findIsLeaderOfLeave(LeaveDto leaveDto);

    @Select("select count(l_id) from t_leave where l_id = #{l_id} and l_status = 1 ")
    boolean findIsToExam(LeaveDto leaveDto);

    @Update("update t_leave set l_sp_date = #{l_date} , l_sp_advice = #{l_sp_advice} , l_spr =(select concat(e_id,'|',e_name) from t_emp where e_id =#{e_id} )  ,l_status = 3 where l_id= #{l_id}")
    void updateLeavePass(LeaveDto leaveDto);

    @Update("update t_leave set l_sp_date = #{l_date} , l_sp_advice = #{l_sp_advice} , l_spr =(select concat(e_id,'|',e_name) from t_emp where e_id =#{e_id} )  ,l_status = 2 where l_id= #{l_id}")
    void updateLeaveBack(LeaveDto leaveDto);
}
